package org.neframework.webtest.action.file;

import java.util.List;
import java.util.Map;

import org.neframework.webtest.model.t_fk_file;
import org.neframework.webtest.service.FileService;

import org.neframework.webtest.base.BaseController;
import com.tmsps.neframework.mvc.annotation.Controller;
import com.tmsps.neframework.mvc.annotation.RequestMapping;
import com.tmsps.neframework.mvc.annotation.ResponseBody;
import com.tmsps.neframework.mvc.plugin.Tip;

@Controller
@RequestMapping("/cp/file")
public class FileController extends BaseController {

	private static final FileService fileService = new FileService();

	@RequestMapping("/imp_local")
	public String imp_local() {
		return "/jsp/file/imp_local.jsp";
	}
	@RequestMapping("/list")
	public String list() {
		return "/jsp/file/list.jsp";
	}
	
	@RequestMapping("/list_data")
	@ResponseBody
	public void list_data(String srh_filename) {

		List<Map<String, Object>> list = fileService.selectFileList(srh_filename, sort_params, page);

		result.put("list", list);
	}
	
	@RequestMapping("/del")
	@ResponseBody
	public void del(String kid) {
		oc.delObjById(kid, t_fk_file.class);

		this.setTipMsg(true, "删除成功!", Tip.Type.success);
	}
	
	@RequestMapping("/download")
	//@ResponseBody
	public void download(String kid) {
		t_fk_file file = (t_fk_file) oc.findObjById(kid, t_fk_file.class);
		
		//return FileFolderTools.getExportUrl() + file.getNew_file_name();
		//this.setTipMsg(true, "下载成功!", Tip.Type.success);
	}
}
